<ui:composition template="/WEB-INF/templates/defaultLayout.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<ui:define name="title">
		#{lang.getTrans("ui.mobile.product.title")} 
	</ui:define>

	<ui:define name="layoutCenter">
		<h:form>
			<p:breadCrumb>
				<p:menuitem value="#{lang.getTrans('ui.mobile.common.bread.home')}" url="/home.xhtml"/>
				<p:menuitem value="#{lang.getTrans('ui.mobile.common.bread.product')}" url="/crud/product/productList.xhtml"/>
				<p:menuitem value="#{lang.getTrans('ui.mobile.common.bread.editar')}" url="/crud/product/productForm.xhtml"/>
			</p:breadCrumb>
			<p:growl id="growl" showDetail="true"/>
			<p:panel id="panel" header="#{lang.getTrans('ui.mobile.product.panel.title')}">
				<h:panelGrid columns="2">
				<h:outputLabel value="#{lang.getTrans('ui.mobile.product.code')}" for="cdCode" />
					<p:inputText id="cdCode" value="#{productBean.product.cdCode}" size="50" maxlength="120"
						requiredMessage="#{lang.getTrans('ui.mobile.product.code.obrigatorio')}" required="true" />
						
					<h:outputLabel value="#{lang.getTrans('ui.mobile.product.name')}" for="cdProduct" />
					<p:inputText id="cdProduct" value="#{productBean.product.cdProduct}" size="50" maxlength="120"
						requiredMessage="#{lang.getTrans('ui.mobile.product.name.obrigatorio')}" required="true"/>

					<h:outputLabel value="#{lang.getTrans('ui.mobile.product.unit')}" for="cdUnit" />
					<p:inputText id="cdUnit" value="#{productBean.product.cdUnit}" size="50" maxlength="120"/>
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.product.brand')}" for="cdBrand" />
					<p:inputText id="cdBrand" value="#{productBean.product.cdBrand}" size="50" maxlength="120" />
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.product.quantity')}" for="nrQuantity" />
					<p:inputText id="nrQuantity" value="#{productBean.product.nrQuantity}" size="20" maxlength="10"
						requiredMessage="#{lang.getTrans('ui.mobile.product.quantity.obrigatorio')}" required="true"/>
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.product.pricebuy')}" for="nrPriceBuy" />
					<p:inputText id="nrPriceBuy" value="#{productBean.product.nrPriceBuy}" size="20" maxlength="10"
						requiredMessage="#{lang.getTrans('ui.mobile.product.pricebuy.obrigatorio')}" required="true"/>
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.product.pricesale')}" for="nrPriceSale" />
					<p:inputText id="nrPriceSale" value="#{productBean.product.nrPriceSale}" size="20" maxlength="10"
						requiredMessage="#{lang.getTrans('ui.mobile.product.pricesale.obrigatorio')}" required="true"/>
					
				</h:panelGrid>
			</p:panel>
			<p:blockUI block="panel" trigger="btSub"/>
			<p:panel style="text-align:center">
				<h:inputHidden id="idProduct" value="#{productBean.product.idProduct}" />
				<h:inputHidden id="nrVersion" value="#{productBean.product.nrVersion}" />
				<p:commandButton id="btSub" value="#{lang.getTrans('ui.mobile.common.save')}"
					type="submit" action="#{productBean.adicionar}" update="growl"/>
				<p:button value="#{lang.getTrans('ui.mobile.common.cancel')}" outcome="product" />
			</p:panel>
		</h:form>
	</ui:define>
</ui:composition>
